import request from "@/utils/request";
import { encryptedData } from "@/utils/encrypt";
import { loginRSA } from "@/config/settings";


export async function login(data) {
    if (loginRSA) {
        data = await encryptedData(data);
    }
    return request({
        url: "/api/user/login",
        method: "post",
        data,
    });
}

export function getUserInfo(accessToken) {
    return request({
        url: "/api/user/userInfo",
        method: "post",
        data: {
            accessToken,
        },
    });
}

export function logout(accessToken) {
    return request({
        url: "/api/user/logout",
        method: "post",
        data: {
            accessToken,
        },
    });
}